Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: watermark filter use commited epoch to read global watermark #17724

Merged
merged 13 commits into from
Jul 19, 2024

Conversation

st1page
Copy link
Contributor

@st1page st1page commented Jul 17, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

fix #16836

But when making modifications, it was found that, in addition to initialization and scaling, querying the global watermark is also necessary when the source is idle. In this situation, using epoch to query could lead to a degradation in concurrent checkpointing, as it would require waiting for the epoch Here, reading with an specific epoc is too restrictive. In fact, what the watermark filter needs here is "to query the most recently committed version available, the newer the better" That is, `get_row(pk, HummockReadEpoch::Committed(current_max_commited_epoch))`.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@github-actions github-actions bot added the type/fix Bug fix label Jul 17, 2024
@st1page st1page marked this pull request as ready for review July 18, 2024 07:29
@st1page st1page requested review from BugenZhao and wenym1 July 18, 2024 07:30
@st1page st1page added need-cherry-pick-release-1.10 Open a cherry-pick PR to branch release-1.10 after the current PR is merged need-cherry-pick-release-1.9 labels Jul 18, 2024
@st1page st1page enabled auto-merge July 18, 2024 10:11
@st1page st1page requested a review from yuhao-su July 18, 2024 10:42
Comment on lines 263 to 265
barrier_num_during_idle += 1;

if barrier_num_during_idle == UPDATE_GLIOBAL_WATERMARK_FREQUENCY_WHEN_IDLE {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without it, the issue will still occur when "relace the table", as it cannot be guaranteed that all actors have been dropped by the time execution reaches here. After adding this logic, it will wait for 10 barriers before proceeding to this point, thereby avoiding the issue.

@st1page st1page added this pull request to the merge queue Jul 18, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 18, 2024
@BugenZhao BugenZhao requested a review from stdrc July 18, 2024 12:14
Copy link
Member

@BugenZhao BugenZhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

current_watermark = Self::get_global_max_watermark(
&table,
&global_watermark_table,
HummockReadEpoch::Committed(prev_epoch),
Copy link
Member

@BugenZhao BugenZhao Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess NoWait is still okay here, cuz we're sure prev_epoch of the Pause checkpoint is committed here.

Command::Pause(reason) => {
if let PausedReason::ConfigChange = reason {
// After the `Pause` barrier is collected and committed, we must ensure that the
// storage version with this epoch is synced to all compute nodes before the
// execution of the next command of `Update`, as some newly created operators
// may immediately initialize their states on that barrier.
self.wait_epoch_commit(self.prev_epoch.value().0).await?;
}
}

By NoWait on update.prev_epoch (i.e. pause.curr_epoch), we're essentially read on the exactly same snapshot as pause.prev_epoch because we ensure that during the Pause barrier no data is written.

@st1page st1page enabled auto-merge July 19, 2024 06:32
@st1page st1page added this pull request to the merge queue Jul 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 19, 2024
@wenym1 wenym1 added this pull request to the merge queue Jul 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 19, 2024
@st1page st1page added this pull request to the merge queue Jul 19, 2024
Merged via the queue into main with commit 625c5aa Jul 19, 2024
29 of 30 checks passed
@st1page st1page deleted the sts/change_watermark_filter_to_wait_committed_epoch branch July 19, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/run-recovery-test-deterministic-simulation need-cherry-pick-release-1.10 Open a cherry-pick PR to branch release-1.10 after the current PR is merged type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: panic when create sink into an APPEND ONLY table without pk with watermark
3 participants